# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Ionut Biru <ibiru@archlinux.org>

pkgbase=gtkmm-4.0
pkgname=(gtkmm-4.0 gtkmm-4.0-docs)
pkgver=4.4.0
pkgrel=1
pkgdesc="C++ bindings for GTK 4"
url="https://www.gtkmm.org/"
arch=(x86_64)
license=(LGPL)
depends=(gtk4 pangomm-2.48)
makedepends=(git meson mm-common glibmm-2.68-docs cairomm-1.16-docs
             pangomm-2.48-docs)
checkdepends=(xorg-server-xvfb)
options=(!emptydirs)
_commit=44bb79e8ee6e86bdc2e6275b8b9c3bded7ec0b3a  # tags/4.4.0^0
source=("git+https://gitlab.gnome.org/GNOME/gtkmm.git#commit=$_commit")
sha256sums=('SKIP')

pkgver() {
  cd gtkmm
  git describe --tags | sed 's/-/+/g'
}

prepare() {
  cd gtkmm
}

build() {
  arch-meson gtkmm build -D maintainer-mode=true
  meson compile -C build
}

check() {
  xvfb-run -s '-nolisten local' meson test -C build --print-errorlogs
}

package_gtkmm-4.0() {
  depends+=(libsigc-3.0.so libglibmm-2.68.so libcairomm-1.16.so
            libpangomm-2.48.so)
  provides=(libgtkmm-4.0.so)

  meson install -C build --destdir "$pkgdir"

  # Split -docs
  mkdir -p docs/usr/share
  mv -t docs/usr/share "$pkgdir"/usr/share/{devhelp,doc}
}

package_gtkmm-4.0-docs() {
  pkgdesc+=" (documentation)"
  depends=()
  options=(!strip)

  mv -t "$pkgdir" docs/*
}
